package com.liuyang.demo.collection;


import java.util.HashMap;
import java.util.Map;

public class TClassDemo {
    public static void main(String[] args) {
        Long id =1L;
        Map<Long,String> idMap = getIdMap();
        Map<String,String> nameMap = getnameMap();
        String a = getFromMap(2L,idMap);
        String b = getFromMap("c",nameMap);
        System.out.println(a);
        System.out.println(b);
    }

    private static <T>  String getFromMap(T key, Map<T, String> map) {
        return map.get(key);
    }

    private static Map<Long, String> getIdMap() {
        Map<Long,String> map = new HashMap<>();
        map.put(1L,"AA");
        map.put(2L,"BB");
        map.put(3L,"CC");
        return map;
    }


    private static Map<String, String> getnameMap() {
        Map<String,String> map = new HashMap<>();
        map.put("a","AA");
        map.put("b","BB");
        map.put("c","CC");
        return map;
    }
}
